package com.cn.mapper;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import com.cn.model.User;

/**
 * 用户模型MAPPER
 * 
 * @author 张顺利
 */
@Mapper
public interface UserMapper {
	
	/**
	 * 获取用户
	 * 
	 * @param user
	 */
	@Select("select * from t_user where username = #{username}")
	User queryUser(String username);
	
	/**
	 * 添加用户
	 * 
	 * @param user
	 */
	@Insert("insert into t_user(mobile,password,devicenum,nickname,birth,sex,height,weight,illcode,addtime) value ( #{mobile},#{password},#{devicenum},#{nickname},#{birth},#{sex},#{height},#{weight},#{illcode},now() ) ")
	void addUser(User user);
	
	/**
	 * 修改用户
	 * 
	 * @param user
	 */
	@Update("update t_user set mobile = #{mobile},password = #{password},nickname = #{nickname},birth = #{birth},sex = #{sex},height = #{height},weight = #{weight},illcode = #{illcode},edittime = now()  where devicenum = #{devicenum}")
	void editUser(User user);
	
}